Skip to content

Implement amplitude damping noise model#545

Closed
Vinny010 wants to merge 1 commit into
TeamGraphix:masterfrom
Vinny010:amplitude-damping-noise
Closed

Implement amplitude damping noise model#545
Vinny010 wants to merge 1 commit into
TeamGraphix:masterfrom
Vinny010:amplitude-damping-noise

Conversation

@Vinny010

Copy link
Copy Markdown
Contributor

Summary

Implements amplitude damping noise for the densitymatrix backend, closing #497. The structure follows DepolarisingNoiseModel throughout.

Channels (graphix/channels.py)

  • amplitude_damping_channel(gamma) — single-qubit channel with Kraus operators $K_1 = \mathrm{diag}(1, \sqrt{1-\gamma})$ and $K_2 = \begin{psmallmatrix}0 & \sqrt{\gamma}\0 & 0\end{psmallmatrix}$, exactly as specified in the issue.
  • two_qubit_amplitude_damping_channel(gamma) — tensor product of two independent single-qubit channels (the four $K_i \otimes K_j$ operators).

Noise elements (graphix/noise_models/amplitude_damping.py)

  • AmplitudeDampingNoise and TwoQubitAmplitudeDampingNoise, both deriving from Noise, exposing nqubits and to_kraus_channel(). The gamma parameter is validated to $[0, 1]$ through the existing Probability() descriptor.

Noise model

  • AmplitudeDampingNoiseModel(NoiseModel), mirroring DepolarisingNoiseModel: per-command damping for preparation (N), entanglement (E, two-qubit), the pre-measurement channel (M), and X/Z corrections (conditioned on their domains), plus an optional classical readout flip via confuse_result. Parameters carry a _gamma suffix to make clear they are damping parameters rather than probabilities.

Public symbols are exported from graphix/noise_models/__init__.py.

Soundness of the tests

The single-qubit channel has the closed form $\Phi_\gamma(\rho) = K_1 \rho K_1^\dagger + K_2 \rho K_2^\dagger$, which gives $\Phi_\gamma(|0\rangle\langle0|) = |0\rangle\langle0|$ (the ground state is a fixed point) and $\Phi_\gamma(|1\rangle\langle1|) = \gamma|0\rangle\langle0| + (1-\gamma)|1\rangle\langle1|$ (the excited state decays with probability $\gamma$). On $|+\rangle$ the action is $\tfrac{1}{2}\begin{psmallmatrix}1+\gamma & \sqrt{1-\gamma}\\sqrt{1-\gamma} & 1-\gamma\end{psmallmatrix}$. On a product state the two-qubit channel equals the Kronecker product of the single-qubit results. These analytic forms are used directly as references and swept over $\gamma \in {0, 0.2, 0.5, 0.9, 1.0}$; trace preservation (CPTP) is asserted explicitly.

At the model level, test_noise_model_inserts_noise_at_each_step checks that the correct ApplyNoise command (channel type, gamma, target nodes, and domain) is inserted at every command kind — including that the measurement channel is applied before the M. End-to-end tests run a transpiled pattern through the densitymatrix backend and match the resulting density matrix against the analytic prediction, and a zero-damping model is verified to reproduce the noiseless result.

CI

Locally passing on this branch: tests/test_amplitude_damping.py (25 tests), with no regressions in test_kraus/test_noise_model; ruff, mypy, and pyright are all clean on the new files.

Happy to adjust the naming or the per-command $\gamma$ conventions to whatever fits the maintainers' preferences best.

Add amplitude damping noise to the density-matrix simulation stack:

- `amplitude_damping_channel` and `two_qubit_amplitude_damping_channel`
  in `graphix.channels`, returning the corresponding `KrausChannel`. The
  two-qubit channel is the tensor product of two independent single-qubit
  channels.
- `AmplitudeDampingNoise` and `TwoQubitAmplitudeDampingNoise` (deriving
  from `Noise`), plus `AmplitudeDampingNoiseModel` (deriving from
  `NoiseModel`), mirroring the structure of `DepolarisingNoiseModel`.
  Channel parameters use a `_gamma` suffix to reflect the damping rate.
- Tests covering the analytic channel action on basis and superposition
  states, two-qubit tensor structure, per-step noise insertion in a
  pattern, zero-damping/noiseless equivalence, and an end-to-end
  preparation-error simulation.

Passes ruff, mypy --strict, pyright, and pytest locally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pranav97nair

Copy link
Copy Markdown

Hi @Vinny010 . Thanks for re-submitting your contribution on this issue. However, since it's the last day of the hackathon, we had a few other PRs close to satisfying our requirements for the amplitude damping issue, and we have decided to accept PR #540. I will therefore close out this PR. Thanks again for your all your contributions to Graphix during this UnitaryHack, we hope to collaborate with you again!

@Vinny010

Copy link
Copy Markdown
Contributor Author

Completely understand — last day, and a close call between several submissions. Congrats to the author of #540, and no worries at all. Thank you for the thoughtful reviews throughout this UnitaryHack; it's been a genuine pleasure contributing to Graphix, and I'd love to collaborate again. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants